import { Component, OnInit } from '@angular/core';
import { uniqueId } from 'lodash';

@Component({
  selector: 'app-demo12',
  templateUrl: './demo12.component.html',
  styles: [],
})
export class Demo12Component implements OnInit {
  data;
  constructor() {}

  ngOnInit() {
    this.initData();
  }

  initData() {
    this.data = Array.from({ length: 20 }).map((item, key) => {
      return this.initUser(key);
    });
  }

  initUser(key: number) {
    return {
      id: uniqueId('uid'),
      name: `user${key}`,
      age: 10 + key,
      expand: false,
      random: parseInt(Math.random() * 100 + '', 10),
      column1: uniqueId('column'),
      column2: uniqueId('column'),
      column3: uniqueId('column'),
      column4: uniqueId('column'),
      column5: uniqueId('column'),
      column6: uniqueId('column'),
      column7: uniqueId('column'),
      column8: uniqueId('column'),
      column9: uniqueId('column'),
      column10: uniqueId('column'),
    };
  }
}
